﻿/****************************************************************************
 * 2018.8 DESKTOP-QE44MRN
 ****************************************************************************/

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using Model;


namespace QFramework.Example
{
	public partial class UITodoItem : UIElement
	{
        public TodoItem todo;
        public Toggle toggle;
        public Text text;
		private void Awake()
		{
            

        }
        public void Init()
        {
            toggle = transform.Find("Finished").GetComponent<Toggle>();
            text = GetComponent<Text>();
            //加委托
            todo.update+= UpdateUI;
            toggle.isOn = todo.Finished;
            text.text = todo.Headline;
        }

        public void UpdateUI()
        {
            toggle.isOn = todo.Finished;
            text.text = todo.Headline;
        }
    }
}